<?php /*a:3:{s:58:"/www/wwwroot/douyin/application/admin/view/source/add.html";i:1713191429;s:60:"/www/wwwroot/douyin/application/admin/view/index_layout.html";i:1710484120;s:53:"/www/wwwroot/douyin/application/admin/view/layui.html";i:1712799662;}*/ ?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title><?php echo config('site.web_name'); ?></title>
    <meta name="author" content="YZNCMS">
    <link rel="stylesheet" href="/static/libs/layui/css/layui.css">
    <link rel="stylesheet" href="/static/admin/css/admin.css?v=<?php echo htmlentities(app('config')->get('version.yzncms_release')); ?>">
    <link rel="stylesheet" href="/static/common/font/iconfont.css?v=<?php echo htmlentities(app('config')->get('version.yzncms_release')); ?>">
    <script src="/static/libs/layui/layui.js"></script>
    <script src="/static/libs/jquery/jquery.min.js"></script>
    <script type="text/javascript">
    //全局变量
    var GV = {
        'site':<?php echo json_encode($site); ?>,
        'image_upload_url': '<?php echo !empty($image_upload_url) ? htmlentities($image_upload_url) :  url("admin/ajax/upload", ["dir" => "images"]); ?>',
        'file_upload_url': '<?php echo !empty($file_upload_url) ? htmlentities($file_upload_url) :  url("admin/ajax/upload", ["dir" => "files"]); ?>',
        'attachment_select_url': '<?php echo !empty($attachment_select_url) ? htmlentities($attachment_select_url) :  url("general.attachments/select"); ?>',
    };
    </script>
</head>

<body class="childrenBody <?php echo defined('IS_DIALOG') && IS_DIALOG ? 'is-dialog' : ''; ?>">
    
<form class="layui-form" method="post">

    <div class="layui-form-item">
        <label class="layui-form-label">分类ID</label>
        <div class="layui-input-block">
            <select name="cid" lay-filter="fieldType" lay-verify="required">
                <option value=""></option>
                <?php if(is_array($cate) || $cate instanceof \think\Collection || $cate instanceof \think\Paginator): $i = 0; $__LIST__ = $cate;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                <option value="<?php echo htmlentities($vo['id']); ?>"><?php echo htmlentities($vo['cate_name']); ?></option>
                <?php endforeach; endif; else: echo "" ;endif; ?>
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">话题</label>
        <div class="layui-input-block">
            <?php echo Form::text('hashtag','',["class"=>"form-tags"]); ?>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">类型</label>
        <div class="layui-input-block" onclick="showAnnex()">
            <?php echo Form::radios('kind',[2=>'图片', 4=>'视频'], ''); ?>
        </div>
    </div>



    <div class="layui-form-item" id="video" style="display: none">
        <label class="layui-form-label">选择视频</label>
        <a class="layui-btn layui-btn-sm" id="uploadMore">
            上传多个视频
        </a>
        <span style="font-size: 18px;color: red" id="nums"></span>
    </div>


    <div class="layui-form-item" id="title" style="display:none;">
        <label class="layui-form-label">标题</label>
        <div class="layui-input-block">
            <input id="c-title" class=" layui-input" name="title" type="text" value="">
        </div>
    </div>



    <div class="layui-form-item" id="image" style="display: none">
        <label class="layui-form-label layui-form-item-required">图片</label>
        <div class="layui-input-block">
            <div class="layui-col-xs4">
                <input type="text" name="pic" id="c-pic" value="" class="layui-input">
            </div>
            <button type="button" class="layui-btn faupload" id="faupload-pic" data-multiple="true"
                    data-input-id="c-pic" data-preview-id="p-pic" data-type="image"><i
                    class="layui-icon layui-icon-upload"></i> 上传
            </button>
            <ul class="layui-row list-inline plupload-preview1" id="p-pic"></ul>
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-block">
            <input id="c-sort" lay-verify="required" class=" layui-input" name="sort" type="number" value="50">
        </div>
    </div>


    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

    
    <script type="text/javascript">
layui.config({
	version: '<?php echo htmlentities(app('config')->get('version.yzncms_release')); ?>',
	base: '/static/libs/layui_exts/'
}).extend({
	yzn: 'yzn/yzn',
	yznForm: 'yznForm/yznForm',
	tab: "pear/tab",               // 多选项卡组件
	yznUpload: 'yznUpload/yznUpload',
	yznTable: 'yznTable/yznTable',
	clipboard: 'clipboard/clipboard.min',
	notice: 'notice/notice.min',
	iconPicker: 'iconPicker/iconPicker.min',
	ztree: 'ztree/ztree',
	dragsort: 'dragsort/dragsort.min',
	tagsinput: 'tagsinput/tagsinput',
	xmSelect: 'xmSelect/xm-select',
	selectPage: 'selectPage/selectpage.min',
	echarts: 'echarts/echarts',
	echartsTheme: 'echarts/echartsTheme',
	citypicker: 'citypicker/city-picker',
	dropzone: 'dropzone/dropzone.min',
	ueditor: 'ueditor/ueditor.min',
	cxselect: 'cxselect/cxselect',
	addons: 'addons',
    aliossUploader:'aliossUploader'
});
</script>
    
    


<script type="text/javascript">
    function showAnnex() {
        var type = $("input[name='kind']:checked").val()
        console.log(type)
        if (type == 2) {
            $('#image').show();
            $('#video').hide();
            $('#title').show();
        } else {
            $('#image').hide();
            $('#video').show();
            $('#title').hidden();
        }

    }


    layui.use(['yznForm', 'aliossUploader'], function () {
        var yznForm = layui.yznForm;

        var aliossUploader = layui.aliossUploader;

        yznForm.bindevent($("form.layui-form"));
        layui.aliossUploader;
        let nums = 0
        aliossUploader.render({
            elm: '#uploadMore',
            region: 'oss-cn-beijing',
            bucket: 'tiktoks-video',
            layerTitle: '上传视频',
            accessidFiled: 'accessid',
            policyFiled: 'policy',
            signatureFiled: 'signature',
            codeFiled: 'code',
            codeStatus: 0,
            policyMethod: 'GET',
            policyData: {},
            policyUrl: '/api/OssClient/getOssSignature',
            httpStr: 'https',
            layerArea: ['800px', '500px'],
            prefixPath: 'coordtrans/',
            fileType: 'image',
            multiple: true,
            allUploaded: function (res) {
                nums += res.length
                res.forEach(function (item) {
                    var input = $('<input>')
                        .attr('type', 'hidden')
                        .attr('name', 'video[]') // 使服务器解析为数组的元素
                        .val(item.ossUrl); // 假设item是视频的标识或URL
                    $('form.layui-form').append(input);
                })

                $('#nums').text(nums + "个视频")

            },
            policyFailed: function (res) {
                layer.msg(JSON.stringify(res));
            },
            uploadRenderData: {
                size: 10000
            }
        });
    });
</script>


<script>

</script>



</body>

</html>